
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                template="/mobile/templates/blankPageTemp.xhtml"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:p="http://primefaces.org/ui"
                xmlns:pm="http://primefaces.org/mobile" 
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j">

    <ui:define name="page">
        <pm:view id="clientData">
            <pm:header title="Dane osobowe">             
                <f:facet name="left"><p:button value="Wróć" icon="back" onclick="PrimeFaces.back()"/></f:facet>
            </pm:header>
            <pm:content>

                <h:form id="userProfile">
                    <p:growl id="grww" showDetail="true"   life="1500"/>  

                    <h:panelGrid columns="2" cellpadding="10">
                        <h:outputLabel for="last" value="#{bundle['client.lastname']}" />  
                        <h:outputText id="last" value="#{clientBean.lastName}" />  

                        <h:outputLabel for="name" value="#{bundle['client.name']}" />  
                        <h:outputText id="name" value="#{clientBean.name}"/>  
                    </h:panelGrid>
          
                    <h:outputText value="#{bundle['client.city']}" rendered="#{clientBean.mobile_startEdit}"/> 

                    <p:inputText value="#{clientBean.city}" rendered="#{clientBean.mobile_startEdit}">
                        <f:validateLength minimum="2" maximum="30" />  
                    </p:inputText>


                    <h:outputText value="#{bundle['client.postcode']}"  rendered="#{clientBean.mobile_startEdit}"/> 

                    <p:inputText value="#{clientBean.zipCode}" rendered="#{clientBean.mobile_startEdit}">
                        <f:validateLength minimum="2" maximum="15" />  
                    </p:inputText>


                    <h:outputText value="#{bundle['client.street']}"  rendered="#{clientBean.mobile_startEdit}"/>  
                    <p:inputText value="#{clientBean.street}" rendered="#{clientBean.mobile_startEdit}"> 
                        <f:validateLength minimum="2" maximum="30" />  
                    </p:inputText>


                    <h:outputText value="#{bundle['client.nrhouse']}"  rendered="#{clientBean.mobile_startEdit}"/> 

                    <p:inputText value="#{clientBean.houseNumber}" rendered="#{clientBean.mobile_startEdit}">
                        <f:validateLength maximum="15" />  
                    </p:inputText>

                    <h:outputText value="#{bundle['client.localNumber']}"  rendered="#{clientBean.mobile_startEdit}"/>  
                    <p:inputText value="#{clientBean.localNumber}" rendered="#{clientBean.mobile_startEdit}">
                        <f:validateLength maximum="11" />  
                    </p:inputText>
                  
                    <h:outputText value="#{bundle['client.phone']}"  rendered="#{clientBean.mobile_startEdit}"/>  

                    <p:inputText  value="#{clientBean.phone}" rendered="#{clientBean.mobile_startEdit}">
                        <f:validateLength  maximum="12" />  
                    </p:inputText>


                    <h:outputText value="#{bundle['client.email']}"  rendered="#{clientBean.mobile_startEdit}"/> 

                    <p:inputText  value="#{clientBean.email}" rendered="#{clientBean.mobile_startEdit}">
                        <f:validateLength  maximum="50" />  
                    </p:inputText>
                    
                
                  <h:panelGrid columns="2" cellpadding="10" id="nonEditable" rendered="#{!clientBean.mobile_startEdit}">
                        
                        <h:outputLabel for="c" value="#{bundle['client.city']}" />  
                        <h:outputText id="c" value="#{clientBean.city}" />  
                        
                        <h:outputLabel for="z" value="#{bundle['client.postcode']}" />  
                        <h:outputText id="z" value="#{clientBean.zipCode}" />  
                        
                        <h:outputLabel for="s" value="#{bundle['client.street']}" />  
                        <h:outputText id="s" value="#{clientBean.street}" />  
                        
                        <h:outputLabel for="h" value="#{bundle['client.nrhouse']}" />  
                        <h:outputText id="h" value="#{clientBean.houseNumber}" />  
                        
                        <h:outputLabel for="l" value="#{bundle['client.localNumber']}" />  
                        <h:outputText id="l" value="#{clientBean.localNumber}" />  
                        
                        <h:outputLabel for="e" value="#{bundle['client.email']}" />  
                        <h:outputText id="e" value="#{clientBean.email}" />  
                        
                        <h:outputLabel for="p" value="#{bundle['client.phone']}" />  
                        <h:outputText id="p" value="#{clientBean.phone}" />  
                        
                 
                  </h:panelGrid>
                      <h:panelGrid columns="2" cellpadding="10" >

                        <h:outputLabel for="nip" value="#{bundle['client.nip']}" />  
                        <h:outputText id="nip" value="#{clientBean.nipNumber}"/>  
                    </h:panelGrid>
                       
    
                  
              




                </h:form> 
                <h:form id="sss">
                  
                <p:selectBooleanCheckbox id="booleanCheckbox" value="#{clientBean.mobile_startEdit}" itemLabel="Tryb edycji" > 
                            <p:ajax event="change" update=":userProfile, save"/>
                        </p:selectBooleanCheckbox>
                    <p:commandButton id="save"  value="Zapisz"  actionListener="#{clientBean.updateClient}" update=":userProfile:grww"  />  
         </h:form>
            </pm:content>
        </pm:view>

    </ui:define>
</ui:composition>